import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 专题信息 */
export interface Welfare {
          id: number; // 专题id
          title?: string; // 专题标题
          author: string; // 作者
          coverPic: string; // 封面图
          content?: string; // 专题内容
          contentConfirmation: string; // 专题确认函
          status: number; // 状态
  }

// 专题 API
export const WelfareApi = {
  // 查询专题分页
  getWelfarePage: async (params: any) => {
    return await request.get({ url: `/mcm/welfare/page`, params })
  },

  // 查询专题详情
  getWelfare: async (id: number) => {
    return await request.get({ url: `/mcm/welfare/get?id=` + id })
  },

  // 新增专题
  createWelfare: async (data: Welfare) => {
    return await request.post({ url: `/mcm/welfare/create`, data })
  },

  // 修改专题
  updateWelfare: async (data: Welfare) => {
    return await request.put({ url: `/mcm/welfare/update`, data })
  },

  // 删除专题
  deleteWelfare: async (id: number) => {
    return await request.delete({ url: `/mcm/welfare/delete?id=` + id })
  },

  /** 批量删除专题 */
  deleteWelfareList: async (ids: number[]) => {
    return await request.delete({ url: `/mcm/welfare/delete-list?ids=${ids.join(',')}` })
  },

  // 导出专题 Excel
  exportWelfare: async (params) => {
    return await request.download({ url: `/mcm/welfare/export-excel`, params })
  },
}